home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / createModelPanelMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  30.0 KB  |  894 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17.  
  18. //-
  19. // ==========================================================================
  20. // Copyright  (C)  Alias|Wavefront,  a division of Silicon Graphics  Limited.
  21. // All rights  reserved.  These coded  instructions,  statements and computer
  22. // programs contain unpublished information  proprietary to  Alias|Wavefront,
  23. // a  division  of  Silicon  Graphics  Limited,  which  is  protected by  the
  24. // Canadian  and  US federal copyright law and  may not be disclosed to third
  25. // parties or  copied  or  duplicated,  in  whole  or in part,  without prior
  26. // written consent of Alias|Wavefront, a division of Silicon Graphics Limited
  27. // ==========================================================================
  28. //+//
  29. //
  30. //  Alias|Wavefront Script File
  31. //  MODIFY THIS AT YOUR OWN RISK
  32. //
  33. //  Creation Date:     6 June 1997
  34. //
  35. //    Create a new model panel with the menu bar
  36. //
  37.  
  38. global int $supportHWshadows;
  39.  
  40. global proc enableIsolateSelect (string $editor, int $enable)
  41. {
  42.     if ($enable) {
  43.         // First, find out what is connected to this editor
  44.         //
  45.         string $mainListConnection = `editor -query -mainListConnection $editor`;
  46.         if ($mainListConnection == "") {
  47.             if ( `menuItem -q -checkBox autoLoadItem` ) {
  48.                 editor -edit -mainListConnection "activeList" $editor;
  49.             }
  50.             else {
  51.                 editor -edit -lck -mainListConnection "activeList" $editor;
  52.             }
  53.         }
  54.         else if (`selectionConnection -query -lock $mainListConnection`) {
  55.             editor -edit -ulk $editor;
  56.             editor -edit -lck $editor;
  57.         }
  58.     }
  59.     modelEditor -edit -viewSelected $enable $editor;
  60. }
  61.  
  62. global proc removeSelectedFromEditor (string $editor)
  63. {
  64.     // Make sure the editor exists
  65.     //
  66.     if (!`editor -exists $editor`) {
  67.         error "Editor not found";
  68.     }
  69.     // If this is a modelEditor, then we can add the members directly
  70.     //
  71.     if (`modelEditor -exists $editor`) {
  72.         modelEditor -edit -removeSelected $editor;
  73.         return;
  74.     }
  75. }
  76.  
  77. global proc updateIsolateMenu( string $parentMenu, string $editor, string $panel )
  78. //
  79. // This updates the shading menu, based on the current settings
  80. // of the model editor
  81. //
  82. {
  83.     loadAnimMenuLibrary;
  84.  
  85.     // Set the proper check state of the AutoLoad menu
  86.     //
  87.     setParent -menu $parentMenu;
  88.  
  89.     if (`menu -query -numberOfItems $parentMenu` == 0) {
  90.         // Register the default connection for this editor
  91.         //
  92.         registerEditor $editor "activeList";
  93.  
  94.         menuItem -label "View Selected" -enableCommandRepeat false
  95.             -checkBox true
  96.             -command ("enableIsolateSelect " + $editor + " #1")
  97.             iselectEnableItem;
  98.         menuItem -label "Auto Load New Objects"
  99.             -checkBox false
  100.             -command ("isoSelectAutoAddNewObjs " + $panel + " #1")
  101.             autoLoadNewItem;
  102.         menuItem -label "Auto Load Selected Objects"
  103.             -checkBox false
  104.             -command ("toggleAutoLoad " + $editor + " #1")
  105.             autoLoadItem;
  106.         menuItem -label "Load Selected Objects"
  107.             -command ("doReload " + $editor)
  108.             reloadItem;
  109.         menuItem -label "Add Selected Objects"
  110.             -command ("addSelectedToEditor " + $editor)
  111.             addToListItem;
  112.         menuItem -label "Remove Selected Objects"
  113.             -command ("removeSelectedFromEditor " + $editor)
  114.             removeFromListItem;
  115.  
  116.         string $menuItem = `menuItem -label "Bookmarks"
  117.             -subMenu true -aob true
  118.             bookMarkHierItem`;
  119.         menuItem -edit
  120.             -postMenuCommand ("buildBookmarkMenu -type bookmarkModelView -editor " + $editor + " " + $menuItem)
  121.             $menuItem;
  122.             menuItem 
  123.                 -label "Bookmark Current Objects" 
  124.                 -command ("createBookmark " + $editor + " bookmarkModelView false") 
  125.                 bookAnimMarkObjectsItem;
  126.                 menuItem -optionBox true
  127.                     -label "Bookmark Current Objects Option Box"
  128.                     -command ("createBookmark " + $editor + " bookmarkModelView true")
  129.                     bookAnimMarkObjectsDialog;
  130.             menuItem -divider true;
  131.             setParent -menu ..;
  132.     }
  133.  
  134.     menuItem -e -checkBox `modelEditor -q -viewSelected $editor` iselectEnableItem;
  135.  
  136.     // First, find out what is connected to this editor
  137.     //
  138.     string $mainListConnection = `editor -query -mainListConnection $editor`;
  139.  
  140.     // If it is NOT the active list, then check it off
  141.     //
  142.     if($mainListConnection != "activeList") {
  143.         menuItem -edit -checkBox off autoLoadItem;
  144.         menuItem -edit -enable true reloadItem;
  145.         menuItem -edit -enable true addToListItem;
  146.     }
  147.     else if (`selectionConnection -query -lock $mainListConnection`) {
  148.         menuItem -edit -checkBox off autoLoadItem;
  149.         menuItem -edit -enable true reloadItem;
  150.         menuItem -edit -enable true addToListItem;
  151.     }
  152.     else {
  153.         menuItem -edit -checkBox on autoLoadItem;
  154.         menuItem -edit -enable false reloadItem;
  155.         menuItem -edit -enable false addToListItem;
  156.     }
  157. }
  158.  
  159. global proc createModelPanelMenu( string $panel )
  160. {
  161.     int $dimWhenNoSelect = 0;
  162.  
  163.     // if this menu has already been built, return
  164.     //
  165.     {
  166.         string $panelControl = `panel -q -control $panel`;
  167.         if ( `menuBarLayout -exists $panelControl` ){
  168.             string $ma[] = `menuBarLayout -q -menuArray $panelControl`;
  169.             for ( $name in $ma ){
  170.                 if ( $name == "View" ){
  171.                     return;
  172.                 }
  173.             }
  174.             setParent $panelControl;
  175.         }
  176.     }
  177.         
  178.     // By the time we get here, we know the menu bar
  179.     // of the modelPanel is the current menu bar
  180.     //
  181.     // Get the name of the model editor in this panel
  182.     //
  183.     string $ed = `modelPanel -q -modelEditor $panel`;
  184.  
  185.     string $itemName;
  186.  
  187.  
  188.     // The shadows menu item will only be available
  189.     // if the hardware support the HWshadows
  190.     //
  191.     global int $supportHWshadows;
  192.     string $checkHWshadowsExt = `openGLExtension -ext "GL_SGIX_shadow"`;
  193.     if( $checkHWshadowsExt == "" )
  194.     {
  195.         $checkHWshadowsExt = `openGLExtension -ext "GL_EXT_texture_env_combine"`;
  196.         if( $checkHWshadowsExt != "" )    {
  197.             $checkHWshadowsExt = `openGLExtension -ext "GL_ARB_multitexture"`;
  198.             if( $checkHWshadowsExt != "" )    {
  199.                 $checkHWshadowsExt = `openGLExtension -ext "GL_EXT_bgra"`;
  200.             }
  201.         }
  202.     }
  203.     if( $checkHWshadowsExt == "" )    { $supportHWshadows = false; }
  204.     else                            { $supportHWshadows = true;    }
  205.  
  206.     menu -tearOff true 
  207.         -l "View" 
  208.         -familyImage "menuIconView.xpm"
  209.         -postMenuCommand ("setFocus "+$ed)
  210.         View;
  211.  
  212.         menuItem -label "Select Camera"
  213.             -command ("{ string $camera = `modelPanel -q -camera "+$panel+"`; "+
  214.                 "eval select `getCameraNode view $camera` `getCameraNode up $camera` $camera; }");
  215.  
  216.         menuItem -divider true;
  217.  
  218.         menuItem -label "Previous View"
  219.             -command ("UndoViewChange");
  220.         menuItem -label "Next View"
  221.             -command ("RedoViewChange");
  222.         menuItem -label "Default Home"
  223.             -command ("{ string $camera = `modelEditor -q -camera "+$ed+"`;"+
  224.                 "viewSet -home $camera;}");
  225.  
  226.         menuItem -d true;
  227.         
  228.         $itemName = `menuItem -label "Look at Selection"
  229.             -command ("{ string $camera = `modelEditor -q -camera "+$ed+"`;"+
  230.                 "viewLookAt $camera;}")`;
  231.         if ($dimWhenNoSelect)
  232.             dimWhen -false SomethingSelected $itemName;
  233.  
  234.         menuItem -label "Frame All" -command ("FrameAll");
  235.  
  236.         $itemName = `menuItem -label "Frame Selection"
  237.             -command ("FrameSelected")`;
  238.         if ($dimWhenNoSelect)
  239.             dimWhen -false SomethingSelected $itemName;
  240.  
  241.         menuItem -divider true;
  242.  
  243.          menuItem -label "Predefined Bookmarks" -subMenu true -tearOff true;
  244.             menuItem -label "Perspective"
  245.                -command ("viewSet -p `modelEditor -q -camera "+$ed+"`;");
  246.             menuItem -label "Front"
  247.                -command ("viewSet -f `modelEditor -q -camera "+$ed+"`;");
  248.             menuItem -label "Top"
  249.                -command ("viewSet -t `modelEditor -q -camera "+$ed+"`;");
  250.             menuItem -label "Right Side"
  251.                -command ("viewSet -rs `modelEditor -q -camera "+$ed+"`;");
  252.             menuItem -label "Left Side"
  253.                -command ("viewSet -ls `modelEditor -q -camera "+$ed+"`;");
  254.             menuItem -label "Back"
  255.                -command ("viewSet -b `modelEditor -q -camera "+$ed+"`;");
  256.             menuItem -label "Bottom"
  257.                -command ("viewSet -bo `modelEditor -q -camera "+$ed+"`;");
  258.         setParent -m ..;
  259.         $itemName = `menuItem -label "Bookmarks" -subMenu true`;
  260.             menuItem -e -postMenuCommand
  261.                 ("buildCameraBookmarkMenu "+$itemName+" "+$panel) $itemName;
  262.         setParent -m ..;
  263.  
  264.         menuItem -divider true;
  265.  
  266.         $itemName = `menuItem -label "Camera Settings" -subMenu true -tearOff true`;
  267.             menuItem -e -postMenuCommand
  268.                 ("buildCameraToggleMenu "+$itemName+" "+$panel) $itemName;
  269.         setParent -m ..;
  270.  
  271.         menuItem -label "Camera Attribute Editor..."
  272.             -command ("showPanelCameraEditor "+$panel);
  273.  
  274.         menuItem -label "Camera Tools" -subMenu true -tearOff true -aob true camerCtrlItem;
  275.  
  276.             menuItem
  277.                 -label      "Tumble Tool" 
  278.                 -annotation (getRunTimeCommandAnnotation("TumbleTool"))
  279.                 -image      "tumble.xpm"
  280.                 -command    ("TumbleTool");
  281.  
  282.             menuItem
  283.                 -optionBox  true 
  284.                 -command    ("TumbleTool; ToolSettingsWindow");
  285.     
  286.             menuItem
  287.                 -label      "Track Tool" 
  288.                 -annotation (getRunTimeCommandAnnotation("TrackTool"))
  289.                 -image      "track.xpm"
  290.                 -command    ("TrackTool");
  291.             
  292.             menuItem
  293.                 -optionBox  true 
  294.                 -command    ("TrackTool; ToolSettingsWindow");
  295.  
  296.             menuItem
  297.                 -label      "Dolly Tool" 
  298.                 -annotation (getRunTimeCommandAnnotation("DollyTool"))
  299.                 -image      "dolly.xpm"
  300.                 -command    ("DollyTool");
  301.  
  302.             menuItem
  303.                 -optionBox  true 
  304.                 -command    ("DollyTool; ToolSettingsWindow");
  305.  
  306.             menuItem
  307.                 -label      "Zoom Tool" 
  308.                 -annotation (getRunTimeCommandAnnotation("ZoomTool"))
  309.                 -image      "boxZoom.xpm"
  310.                 -command    ("ZoomTool");
  311.  
  312.             menuItem
  313.                 -optionBox   true
  314.                 -command     ("ZoomTool; ToolSettingsWindow");
  315.     
  316.             menuItem -divider true;
  317.  
  318.             menuItem -label "Roll Tool" 
  319.                 -annotation "Roll Tool: Roll the camera"
  320.                 -image "roll.xpm"
  321.                 -command "setToolTo rollContext";
  322.  
  323.             menuItem -optionBox true 
  324.                 -command "setToolTo rollContext; toolPropertyWindow";
  325.  
  326.             menuItem -label "Azimuth Elevation Tool" 
  327.                 -annotation "Azimuth Elevation Tool: Change the Azimuth Elevation"
  328.                 -image "azimuthElevation.xpm"
  329.                 -command "setToolTo azimuthElevationContext";
  330.  
  331.             menuItem -optionBox true 
  332.                 -command "setToolTo azimuthElevationContext; toolPropertyWindow";
  333.  
  334.             menuItem -label "Yaw-Pitch Tool" 
  335.                 -annotation "Yaw-Pitch Tool: Change the camera Yaw and Pitch"
  336.                 -image "yawPitch.xpm"
  337.                 -command "setToolTo yawPitchContext";
  338.  
  339.             menuItem -optionBox true 
  340.                 -command "setToolTo yawPitchContext; toolPropertyWindow";
  341.  
  342.             menuItem -label "Fly Tool" 
  343.                 -annotation "Fly Tool:  Change the camera direction and position"
  344.                 -command "setToolTo flyThroughContext";
  345.  
  346.         setParent -menu ..;
  347.  
  348.         menuItem -divider true;
  349.  
  350.         string $imagePlaneMenuName = $ed + "imagePlaneSubMenu";
  351.  
  352.         menuItem -label "Image Plane" -subMenu true -tearOff true
  353.             $imagePlaneMenuName;
  354.  
  355.         menuItem -e -postMenuCommand
  356.             ("buildImagePlaneMenu " + $imagePlaneMenuName + " " + $panel)
  357.             $imagePlaneMenuName;
  358.  
  359.         setParent -m ..;
  360.  
  361.  
  362.     setParent -m ..;
  363.  
  364.     $itemName = `menu -tearOff true 
  365.             -aob true 
  366.             -l "Shading"
  367.             -postMenuCommandOnce false
  368.             -familyImage "menuIconShading.xpm"`;
  369.     menu -edit -pmc ("updateShadingMenu "+$itemName+" "+$ed) $itemName;
  370.  
  371.         radioMenuItemCollection;
  372.         menuItem -radioButton true -label "Wireframe"
  373.             -command ("DisplayWireframe")
  374.             shadeWireItem;
  375.         menuItem -radioButton false -label "Smooth Shade All"
  376.             -command ("modelEditor -edit -displayAppearance smoothShaded -activeOnly false " + $ed)
  377.             shadeSmoothItem;
  378.         menuItem -radioButton false -label "Smooth Shade Selected Items"
  379.             -command ("modelEditor -edit -displayAppearance smoothShaded -activeOnly true " + $ed)
  380.             shadeSmoothSelectedItem;
  381.         menuItem -radioButton false -label "Flat Shade All"
  382.             -command ("modelEditor -edit -displayAppearance flatShaded -activeOnly false " + $ed)
  383.             shadeFlatItem;
  384.         menuItem -radioButton false -label "Flat Shade Selected Items"
  385.             -command ("modelEditor -edit -displayAppearance flatShaded -activeOnly true " + $ed)
  386.             shadeFlatSelectedItem;
  387.         menuItem -radioButton false -label "Bounding Box"
  388.             -command ("modelEditor -edit -displayAppearance boundingBox " + $ed)
  389.             shadeBBoxItem;
  390.         menuItem -radioButton false -label "Points"
  391.             -command ("modelEditor -edit -displayAppearance points " + $ed)
  392.             shadePointsItem;
  393.  
  394.         menuItem -divider true;
  395.  
  396.         menuItem -sm true -l "Shade Options" shadeOptionItem;
  397.             menuItem -checkBox 1 -l "Wireframe on Shaded"
  398.                 -command ("modelEditor -e -wos #1 "+$ed)
  399.                 wireOnShadedItem;
  400.  
  401.             menuItem -checkBox false -l "X-Ray"
  402.                 -command ("modelEditor -e -xray #1 "+$ed)
  403.                 xrayItem;
  404.  
  405.             menuItem -checkBox false -l "Transparency Sorting"
  406.                 -command ("modelEditor -e -st #1 "+$ed)
  407.                 transpSortItem;
  408.  
  409.         setParent -m ..;
  410.  
  411.         menuItem -sm true -l "Interactive Shading" interactiveShadingItem;
  412.             radioMenuItemCollection;
  413.             menuItem -radioButton true -l "Normal"
  414.                 -command ("modelEditor -e -useInteractiveMode off "+$ed)
  415.                 useInteractiveItem;
  416.             menuItem -radioButton false -l "Wireframe"
  417.                 -command ("modelEditor -e -interactive -useInteractiveMode on " + 
  418.                     "-da wireframe "+$ed)
  419.                 interactiveShadeWireItem;
  420.             menuItem -radioButton false -l "Bounding Box"
  421.                 -command ("modelEditor -e -interactive -useInteractiveMode on " +
  422.                     "-da boundingBox "+$ed)
  423.                 interactiveShadeBBoxItem;
  424.             menuItem -radioButton false -l "Points"
  425.                 -command ("modelEditor -e -interactive -useInteractiveMode on " +
  426.                     "-da points "+$ed)
  427.                 interactiveShadePointsItem;
  428.         setParent -m ..;
  429.         menuItem -d true;
  430.  
  431.  
  432.         if (`about -nt` || `about -mac`)
  433.         {
  434.             menuItem -checkBox true -l "Dense Wireframe Acceleration"
  435.                 -command ("modelEditor -e -wbs #1 "+$ed)
  436.                 backingStoreItem;
  437.         }
  438.         else
  439.         {
  440.             menuItem -checkBox true -l "Color Index Mode"
  441.                 -command ("modelEditor -e -useColorIndex #1 "+$ed)
  442.                 colorIndexItem;
  443.         }
  444.         menuItem -checkBox false -label "Backface Culling" 
  445.             -command ("ToggleBackfaceCulling")
  446.             -annotation (getRunTimeCommandAnnotation("ToggleBackfaceCulling"))
  447.             backFaceCullingItem;
  448.  
  449.         menuItem -checkBox false -l "Smooth Wireframe"
  450.             -command ("modelEditor -e -smoothWireframe #1 "+$ed)
  451.             smoothWireframeItem;
  452.  
  453.         if (`about -irix`)
  454.         {
  455.             menuItem -edit -enable false smoothWireframeItem;
  456.         }
  457.  
  458.         menuItem -d true;
  459.         menuItem -checkBox false 
  460.             -l "Hardware Texturing" 
  461.             -command ("modelEditor -e -displayTextures #1 "+$ed) 
  462.             dispTexItem;
  463.         menuItem -enableCommandRepeat false -optionBox 1 
  464.             -l "Hardware Texturing Option Box"
  465.             -command ("hwTxOptions 1 "+$ed)  dispTexOptionItem;
  466.  
  467.         menuItem -checkBox false
  468.             -l "Hardware Fog"
  469.             -command ("modelEditor -e -fogging #1 "+$ed)
  470.             dispFogItem;
  471.         menuItem -enableCommandRepeat false -optionBox 1 
  472.             -l "Hardware Fog Option Box"
  473.             -command ("hwFogOptions 1 "+$ed) dispFogOptionItem;
  474.  
  475.         menuItem -divider true;
  476.  
  477.         menuItem -label "Apply Current to All"
  478.             -command ( "updateAllModelEditorsToShadingSetting( \"" + $itemName 
  479.                  + "\", \"" + $ed  + "\")" )
  480.             updateAllViewsItem;
  481.         
  482.     $itemName = `menu -tearOff true 
  483.             -l "Lighting"
  484.             -postMenuCommandOnce false
  485.             -familyImage "menuIconLighting.xpm"`;
  486.     menu -e -pmc ("updateLightingMenu "+$itemName+" "+$ed) $itemName;
  487.         radioMenuItemCollection;
  488.         menuItem -radioButton true -l "Use Default Lighting"
  489.             -command ("modelEditor -e -dl \"default\" "+$ed)
  490.             lightDefaultItem;
  491.         menuItem -radioButton false -l "Use All Lights"
  492.             -command ("DisplayLight")
  493.             lightAllItem;
  494.         menuItem -radioButton false -l "Use Selected Lights"
  495.             -command ("modelEditor -e -dl active "+$ed)
  496.             lightActiveItem;
  497.         menuItem -radioButton false -l "Use No Lights"
  498.             -command ("modelEditor -e -dl none "+$ed)
  499.             lightNoneItem;
  500.         menuItem -radioButton false -enable false -l "Use Previously Specified Lights "
  501.             lightPreviousItem;
  502.         menuItem -divider true;
  503.         menuItem -checkBox false -enable true -l "Two Sided Lighting"
  504.             -command ("modelEditor -e -twoSidedLighting #1 "+$ed)
  505.             lightTwoSidedItem;
  506.         menuItem -checkBox false -enable $supportHWshadows -l "Shadows"
  507.             -command ("modelEditor -e -shadows #1 "+$ed)
  508.             lightHardwareShadows;
  509.         menuItem -divider true;
  510.         $itemName = `menuItem -label "Specify Selected Lights"
  511.             -command ("modelEditor -e -dl selected "+$ed)
  512.             lightSelectedItem`;
  513.         if ($dimWhenNoSelect)
  514.             dimWhen -false SomethingSelected $itemName;
  515.  
  516.     $itemName = `menu -tearOff true 
  517.             -l "Show"
  518.             -postMenuCommandOnce false
  519.             -familyImage "menuIconShow.xpm"`;
  520.     menu -e -pmc ("updateShowMenu "+$itemName+" "+$ed) $itemName;
  521.  
  522.  
  523.         $itemName = `menuItem -label "Isolate Select" -subMenu true -tearOff true`;
  524.         menuItem -e -pmc ("updateIsolateMenu "+$itemName+" "+$ed+" "+$panel) $itemName;
  525.         setParent -m ..;
  526.  
  527.         menuItem -divider true;
  528.  
  529.         menuItem -label "All" -enableCommandRepeat false
  530.             -command ("modelEditor -e -allObjects 1 " + $ed + ";updateShowMenu "+$itemName+" "+$ed)
  531.             showAllItem;
  532.         menuItem -label "None" -enableCommandRepeat false
  533.             -command ("modelEditor -e -allObjects 0 " + $ed + ";updateShowMenu "+$itemName+" "+$ed)
  534.             showNoneItem;
  535.  
  536.         menuItem -divider true;
  537.  
  538.         menuItem -label "NURBS Curves" -checkBox 1 -enableCommandRepeat false
  539.             -command ("modelEditor -e -nurbsCurves #1 " + $ed)
  540.             showNurbsCurvesItem;
  541.         menuItem -label "NURBS Surfaces" -checkBox 1 -enableCommandRepeat false
  542.             -command ("modelEditor -e -nurbsSurfaces #1 " + $ed)
  543.             showNurbsSurfacesItem;
  544.         menuItem -label "Polygons" -checkBox 1 -enableCommandRepeat false
  545.             -command ("modelEditor -e -polymeshes #1 " + $ed)
  546.             showPolymeshesItem;
  547.         menuItem -label "Subdiv Surfaces" -checkBox 1 -enableCommandRepeat false
  548.             -command ("modelEditor -e -subdivSurfaces #1 " + $ed)
  549.             showSubdivSurfacesItem;
  550.         menuItem -label "Planes" -checkBox 1 -enableCommandRepeat false
  551.             -command ("modelEditor -e -planes #1 " + $ed)
  552.             showPlanesItem;
  553.         menuItem -label "Lights" -checkBox 1 -enableCommandRepeat false
  554.             -command ("modelEditor -e -lights #1 " + $ed)
  555.             showLightsItem;
  556.         menuItem -label "Cameras" -checkBox 1 -enableCommandRepeat false
  557.             -command ("modelEditor -e -cameras #1 " + $ed)
  558.             showCamerasItem;
  559.         menuItem -label "Joints" -checkBox 1 -enableCommandRepeat false
  560.             -command ("modelEditor -e -joints #1 " + $ed)
  561.             showJointsItem;
  562.         menuItem -label "IK Handles" -checkBox 1 -enableCommandRepeat false
  563.             -command ("modelEditor -e -ikHandles #1 " + $ed)
  564.             showIkHandlesItem;
  565.         menuItem -label "Deformers" -checkBox 1 -enableCommandRepeat false
  566.             -command ("modelEditor -e -deformers #1 " + $ed)
  567.             showDeformersItem;
  568.         menuItem -label "Dynamics" -checkBox 1 -enableCommandRepeat false
  569.             -command ("modelEditor -e -dynamics #1 " + $ed)
  570.             showDynamicsItem;
  571.         if( fluidEditLicenseFound() ) {
  572.             menuItem -label "Fluids" -checkBox 1 -enableCommandRepeat false
  573.                 -command ("modelEditor -e -fluids #1 " + $ed)
  574.                 showFluidsItem;
  575.         }
  576.         menuItem -label "Locators" -checkBox 1 -enableCommandRepeat false
  577.             -command ("modelEditor -e -locators #1 " + $ed)
  578.             showLocatorsItem;
  579.         menuItem -label "Dimensions" -checkBox 1 -enableCommandRepeat false
  580.             -command ("modelEditor -e -dimensions #1 " + $ed)
  581.             showDimensionsItem;
  582.         menuItem -label "Pivots" -checkBox 1 -enableCommandRepeat false
  583.             -command ("modelEditor -e -pivots #1 " + $ed)
  584.             showPivotsItem;
  585.         menuItem -label "Handles" -checkBox 1 -enableCommandRepeat false
  586.             -command ("modelEditor -e -handles #1 " + $ed)
  587.             showHandlesItem;
  588.         menuItem -label "Textures" -checkBox 1 -enableCommandRepeat false
  589.             -command ("modelEditor -e -textures #1 " + $ed)
  590.             showTexturesItem;
  591.         if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  592.             menuItem -label "Strokes" -checkBox 1 -enableCommandRepeat false
  593.                 -command ("modelEditor -e -strokes #1 " + $ed)
  594.                 showStrokesItem;
  595.         }
  596.  
  597.         menuItem -divider true;
  598.  
  599.         menuItem -label "NURBS CVs" -checkBox 1 -enableCommandRepeat false
  600.             -command ("modelEditor -e -cv #1 " + $ed)
  601.             showNurbsCVsItem;
  602.         menuItem -label "NURBS Hulls" -checkBox 1 -enableCommandRepeat false
  603.             -command ("modelEditor -e -hulls #1 " + $ed)
  604.             showNurbsHullsItem;
  605.         menuItem -label "Grid" -checkBox 1 -enableCommandRepeat false
  606.             -command ("modelEditor -e -grid #1 " + $ed)
  607.             showGridItem;
  608.  
  609.  
  610.     buildPanelPopupMenu( $panel );
  611.  
  612. }
  613.  
  614. global proc updateAllModelEditorsToShadingSetting( string $menu, string $ed )
  615. //
  616. // Update all model editors to have the same settings as this one
  617. // 
  618. //
  619. {
  620.     string $shadeMode = `modelEditor -q -displayAppearance $ed`;
  621.     string $interactiveShadeMode = 
  622.         `modelEditor -q -interactive -displayAppearance $ed`;
  623.     int $xray = `modelEditor -q -xray $ed`;
  624.     int $transpSort = `modelEditor -q -st $ed`;
  625.     int $useInteractiveMode = `modelEditor -q -useInteractiveMode $ed`;
  626.     int $activeOnly = `modelEditor -q -activeOnly $ed`;
  627.     int $useColorIndex = `modelEditor -q -useColorIndex $ed`;
  628.     int $culling = `modelEditor -q -backfaceCulling $ed`;
  629.     int $wireOnShaded = `modelEditor -q -wireframeOnShaded $ed`;
  630.     int $textures = `modelEditor -q -displayTextures $ed`;
  631.     int $fogging = `modelEditor -q -fogging $ed`;
  632.     int $backingStore = `modelEditor -q -wbs $ed`;
  633.     int $smoothWireframe = `modelEditor -q -smoothWireframe $ed`;
  634.  
  635.     string $editors[] = `getPanel -type "modelPanel"`;
  636.  
  637.     for ( $editor in $editors ) {
  638.         modelEditor -edit 
  639.             -displayAppearance $shadeMode
  640.             -xray $xray
  641.             -st $transpSort 
  642.             -useInteractiveMode $useInteractiveMode
  643.             -activeOnly $activeOnly
  644.             -useColorIndex $useColorIndex
  645.             -wbs $backingStore
  646.             -backfaceCulling $culling
  647.             -wireframeOnShaded $wireOnShaded
  648.             -fogging $fogging
  649.             -displayTextures $textures
  650.             -smoothWireframe $smoothWireframe
  651.             $editor;
  652.         modelEditor -edit -interactive 
  653.             -displayAppearance $interactiveShadeMode
  654.             $editor;
  655.     }
  656. }
  657.  
  658. global proc updateShadingMenu( string $menu, string $ed )
  659. //
  660. // This updates the shading menu, based on the current settings
  661. // of the model editor
  662. //
  663. {
  664.     setParent -m $menu;
  665.     string $shadeMode = `modelEditor -q -displayAppearance $ed`;
  666.     string $interactiveShadeMode = 
  667.         `modelEditor -q -interactive -displayAppearance $ed`;
  668.     int $xray = `modelEditor -q -xray $ed`;
  669.     int $transpSort = `modelEditor -q -st $ed`;
  670.     int $useInteractiveMode = `modelEditor -q -useInteractiveMode $ed`;
  671.     int $activeOnly         = `modelEditor -q -activeOnly $ed`;
  672.     int $culling            = `modelEditor -q -backfaceCulling $ed`;
  673.     int $fogging = `modelEditor -q -fogging $ed`;
  674.     int $textures           = `modelEditor -q -displayTextures $ed`;
  675.     int $colorIndex         = `modelEditor -q -useColorIndex $ed`;
  676.     int $backingStore       = `modelEditor -q -wbs $ed`;
  677.     int $smoothWireframe = `modelEditor -q -smoothWireframe $ed`;
  678.     int $modeIsShaded = false;
  679.  
  680.     menuItem -e -checkBox `modelEditor -q -wos $ed` wireOnShadedItem;
  681.  
  682.     // Set the radio buttons to reflect which display
  683.     // style is selected
  684.     //
  685.     switch($shadeMode){
  686.         case "wireframe":
  687.             menuItem -e -radioButton true shadeWireItem;
  688.             menuItem -e -enable true shadeOptionItem;
  689.             break;
  690.         case "points":
  691.             menuItem -e -radioButton true shadePointsItem;
  692.             menuItem -e -enable false shadeOptionItem;
  693.             break;
  694.         case "boundingBox":
  695.             menuItem -e -radioButton true shadeBBoxItem;
  696.             menuItem -e -enable false shadeOptionItem;
  697.             break;
  698.         case "smoothShaded":
  699.             $modeIsShaded = true;
  700.             if ( $activeOnly ){
  701.                 menuItem -e -radioButton true shadeSmoothSelectedItem;
  702.             } else {
  703.                 menuItem -e -radioButton true shadeSmoothItem;
  704.             }
  705.             menuItem -e -enable true shadeOptionItem;
  706.             break;
  707.         case "flatShaded":
  708.             $modeIsShaded = true;
  709.             if ( $activeOnly ){
  710.                 menuItem -e -radioButton true shadeFlatSelectedItem;
  711.             } else {
  712.                 menuItem -e -radioButton true shadeFlatItem;
  713.             }
  714.             menuItem -e -enable true shadeOptionItem;
  715.             break;
  716.         default:
  717.             menuItem -e -enable true shadeOptionItem;
  718.             break;
  719.     }    
  720.  
  721.     menuItem -e -checkBox $xray xrayItem;
  722.     menuItem -e -checkBox $transpSort transpSortItem;
  723.     menuItem -e -checkBox $textures dispTexItem;
  724.     menuItem -e -checkBox $fogging dispFogItem;
  725.     menuItem -e -checkBox $culling backFaceCullingItem;
  726.     menuItem -e -checkBox $smoothWireframe smoothWireframeItem;
  727.  
  728.     if (`menuItem -exists colorIndexItem`)
  729.     {
  730.         menuItem -e -checkBox $colorIndex colorIndexItem;
  731.     }
  732.     if (`menuItem -exists backingStoreItem`)
  733.     {
  734.         menuItem -e -checkBox $backingStore backingStoreItem;
  735.     }
  736.  
  737.     // Set the radio buttons to reflect which interactive
  738.     // mode is selected
  739.     //
  740.     if ( $useInteractiveMode ) {
  741.         switch($interactiveShadeMode){
  742.             case "wireframe":
  743.                 menuItem -e -radioButton true interactiveShadeWireItem;
  744.                 break;
  745.             case "points":
  746.                 menuItem -e -radioButton true interactiveShadePointsItem;
  747.                 break;
  748.             case "boundingBox":
  749.                 menuItem -e -radioButton true interactiveShadeBBoxItem;
  750.                 break;
  751.         }
  752.     } else {
  753.         menuItem -e -radioButton true useInteractiveItem;
  754.     }
  755.  
  756.     string $pcamera = `modelPanel -q -camera $ed`;
  757.     int $isOrtho = `getAttr ($pcamera+".orthographic")`;
  758.     menuItem -e -enable false -checkBox $fogging dispFogItem;
  759.     menuItem -e -enable false dispFogOptionItem;
  760.  
  761.     if ( $modeIsShaded ) {
  762.         // Xray is valid in shaded mode, but color index is not
  763.         //
  764.         menuItem -e -en true xrayItem;
  765.         menuItem -e -en true transpSortItem;
  766.         menuItem -e -en true backFaceCullingItem;
  767.         menuItem -e -en true dispTexItem;
  768.         menuItem -e -en true dispTexOptionItem;
  769.  
  770.         if ($isOrtho == 0) {
  771.             menuItem -e -en true dispFogItem;
  772.             menuItem -e -en true dispFogOptionItem;
  773.         }
  774.         if (`menuItem -exists colorIndexItem`) menuItem -e -en false colorIndexItem;
  775.     } else {
  776.         menuItem -e -en false xrayItem;
  777.         menuItem -e -en false transpSortItem;
  778.         menuItem -e -en false backFaceCullingItem;
  779.         menuItem -e -en false dispTexItem;
  780.         menuItem -e -en false dispTexOptionItem;
  781.         if (`menuItem -exists colorIndexItem`) menuItem -e -en true colorIndexItem;
  782.     }
  783. }
  784.  
  785.  
  786. global proc updateLightingMenu( string $menu, string $ed )
  787. //
  788. // This updates the lighting menu, based on the current settings
  789. // of the model editor
  790. //
  791. {
  792.     global int $supportHWshadows;
  793.  
  794.     setParent -m $menu;
  795.     string $lightingMode  = `modelEditor -q -displayLights $ed`;
  796.     int    $twoSidedLighting = `modelEditor -q -twoSidedLighting $ed`;
  797.     int $shadows = `modelEditor -q -shadows $ed`;
  798.  
  799.     menuItem -e -checkBox $twoSidedLighting lightTwoSidedItem;
  800.  
  801.     menuItem -e -enable false lightPreviousItem;
  802.     
  803.     string $pcamera = `modelPanel -q -camera $ed`;
  804.     int $isOrtho = `getAttr ($pcamera+".orthographic")`;
  805.  
  806.     // When the menuItem was in a disabled state, but is enabled through
  807.     // a script during a file loading, the menuItem can not be disabled.
  808.     // Hence, by setting it to be enabled before disabling it will
  809.     // synch the state of the menuItem properly.
  810.     // 
  811.     menuItem -e -enable true lightHardwareShadows;
  812.     menuItem -e -enable false -checkBox $shadows lightHardwareShadows;
  813.  
  814.     switch($lightingMode){
  815.       case "selected":
  816.         menuItem -e -enable true -radioButton true lightPreviousItem;
  817.         if ($isOrtho == 0)
  818.             menuItem -e -enable $supportHWshadows lightHardwareShadows;
  819.         break;
  820.       case "active":
  821.         menuItem -e -radioButton true lightActiveItem;
  822.         if ($isOrtho == 0)
  823.             menuItem -e -enable $supportHWshadows lightHardwareShadows;
  824.         break;
  825.       case "all":
  826.         menuItem -e -radioButton true lightAllItem;
  827.         if ($isOrtho == 0)
  828.             menuItem -e -enable $supportHWshadows lightHardwareShadows;
  829.         break;
  830.       case "none":
  831.         menuItem -e -enable true lightNoneItem;
  832.         break;
  833.       case "default":
  834.         menuItem -e -radioButton true lightDefaultItem;
  835.         break;
  836.     }
  837. }
  838.  
  839. global proc updateShowMenu( string $menu, string $ed )
  840. //
  841. // This updates the shading menu, based on the current settings
  842. // of the model editor
  843. //
  844. {
  845.     setParent -m $menu;
  846.  
  847.     menuItem -e -checkBox `modelEditor -q -nurbsCurves $ed` showNurbsCurvesItem;
  848.     menuItem -e -checkBox `modelEditor -q -nurbsSurfaces $ed` showNurbsSurfacesItem;
  849.     menuItem -e -checkBox `modelEditor -q -polymeshes $ed` showPolymeshesItem;
  850.     menuItem -e -checkBox `modelEditor -q -subdivSurfaces $ed` showSubdivSurfacesItem;
  851.     menuItem -e -checkBox `modelEditor -q -planes $ed` showPlanesItem;
  852.     menuItem -e -checkBox `modelEditor -q -cameras $ed` showCamerasItem;
  853.     menuItem -e -checkBox `modelEditor -q -lights $ed` showLightsItem;
  854.     menuItem -e -checkBox `modelEditor -q -joints $ed` showJointsItem;
  855.     menuItem -e -checkBox `modelEditor -q -ikHandles $ed` showIkHandlesItem;
  856.     menuItem -e -checkBox `modelEditor -q -pivots $ed` showPivotsItem;
  857.     menuItem -e -checkBox `modelEditor -q -handles $ed` showHandlesItem;
  858.     menuItem -e -checkBox `modelEditor -q -deformers $ed` showDeformersItem;
  859.     menuItem -e -checkBox `modelEditor -q -dynamics $ed` showDynamicsItem;
  860.     if( fluidEditLicenseFound() ) {
  861.         menuItem -e -checkBox `modelEditor -q -fluids $ed` showFluidsItem;
  862.     }
  863.     menuItem -e -checkBox `modelEditor -q -locators $ed` showLocatorsItem;
  864.     menuItem -e -checkBox `modelEditor -q -dimensions $ed` showDimensionsItem;
  865.     menuItem -e -checkBox `modelEditor -q -textures $ed` showTexturesItem;
  866.     if (`isTrue "MayaCreatorExists"` && (`licenseCheck -m "edit" -typ "particlePaint"`)) {
  867.         menuItem -e -checkBox `modelEditor -q -strokes $ed` showStrokesItem;
  868.     }
  869.  
  870.     menuItem -e -checkBox `modelEditor -q -cv $ed` showNurbsCVsItem;
  871.     menuItem -e -checkBox `modelEditor -q -hulls $ed` showNurbsHullsItem;
  872.     menuItem -edit
  873.         -enable `grid -query -toggle`
  874.         -checkBox `modelEditor -q -grid $ed` showGridItem;
  875. }
  876.  
  877. global proc isoSelectAutoAddNewObjs(string $panel, int $state)
  878. {
  879.     global int $autoAddNewObjJobNum = -1;
  880.  
  881.     if ($state)
  882.     {
  883.         if (!`scriptJob -ex $autoAddNewObjJobNum`)
  884.         {
  885.             $autoAddNewObjJobNum = `scriptJob -protected 
  886.                 -event "DagObjectCreated" ("isolateSelect -addSelected " + $panel)`;
  887.         }
  888.     }
  889.     else
  890.     {
  891.         scriptJob -force -kill $autoAddNewObjJobNum;
  892.     }
  893. }
  894.